package com.itheima.feign.fallback;

import com.itheima.entity.OrderEntity;
import com.itheima.feign.order.OrderFeign;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * @Description:  出现限流或者是异常时调用类
 * @Version: V1.0
 */
@Component
public class OrderFeignFallback implements OrderFeign {

    /**
     * 降级方法， 失败的时候会被调用
     * @param userId
     * @return
     */
    @Override
    public List<OrderEntity> findOrderInfoByUserId(Integer userId) {
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setId(-1);
        orderEntity.setGoodsName("被降级了...");
        return Arrays.asList(orderEntity);
    }

    @Override
    public void findAll() {

    }
}
